[Cocoa] CoreData bindings for NSPopupButton

Posted by ndg on Stack Overflow See other posts from Stack Overflow or by ndg
Published on 2010-05-03T12:50:58Z Indexed on 2010/05/03 12:58 UTC
Read the original article Hit count: 495

Filed under:
|
|

I'm looking to use a dropdown menu (possibly an NSPopupButton object) to represent the hierarchical results of two Core Data entities (Genre and Movie) and their relationships. In my current data model, my Genre entity has a one-to-many relationship with my Movie entity.

What I'm now looking to do is generate the contents of an NSPopupButton to show a hierarchical list of Genres and the Movies associated with them, like so:

Genre 1
    Film 1
    Film 2
Genre 2
    Film 3
    Film 4

Note that, in the above example, only Movie objects are to be selectable by the user (Genre objects will appear, but be unselectable). Also, to complicate matters slightly, I have an additional NSPopupButton which lists Movie Rental locations. The location selected by the user ultimately impacts on the genres and films available in the second dropdown.

I imagine that bindings will only take me so far with this problem and that, ultimately, I'll have to populate the contents of the dropdown menu myself. I'm posting here for thoughts and opinions on the best way to go about this.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about core-data